<template>
  <div>
    <van-nav-bar title="详情页面" left-arrow @click-left="$router.go(-1)" />
    <img :src="goodinfo.pic" style="width:100%" />
    <van-card :price="goodinfo.price" :title="goodinfo.title">
        <template #num>
        <van-stepper v-model="num"></van-stepper>
        </template>
    </van-card>
    
  </div>
</template>

<script>
export default {
  // 组件名称
  name: "demo", // 组件参数 接收来自父组件的数据
  props: [], // 局部注册的组件
  components: {}, // 组件状态值
  data() {
    return {
      goodinfo: {},
      num:1,
    };
  }, // 计算属性
  computed: {}, // 侦听器
  watch: {}, // 组件方法
  methods: {}, // 以下是生命周期钩子 注：没用到的钩子请自行删除
  created() {},
  mounted() {
    let id = this.$route.query.id;
    this.$axios.get("/json/list.json").then((res) => {
      //筛选列表中的数据
      this.goodinfo = res.result.find((item) => {
        return item._id == id;
      });
    });
  },
  updated() {},
};
</script>

<style scoped></style>
